import http from '@/utils/http'
import {StageList,AddModel} from './01type'
enum Api{
  stageParams='/stage/page',
  stageDelete='/stage/delete',
  stageAdd='/stage/add',
  stageUpdate = '/stage/update',
  checklistParams='/checklist/analysePage',
  checklistAdd='/checklist/analyseAdd',
  checklistDelete = '/checklist/remove',
  checkListPage='/checklist/checklistPage',
  checkListAdds='/checklist/checklistAdd',

}
/**
 * 
 * @param params 获取阶段模板数据
 * @returns 
 */
export const stagePageApi=async (params:StageList)=>{
  return http.get(Api.stageParams,params)
}
/**
 * 删除阶段模板
 */
export const stageDeleteApi=async(id:Object)=>{
  return http.post(Api.stageDelete,id)
}
/**
 * 阶段添加
 */
export const stageAddApi=async(params:AddModel)=>{
  return http.post(Api.stageAdd,params)
}
/**
 * 修改阶段信息
 */
export const stageUpdateApi = async (params:AddModel)=>{
  return http.post(Api.stageUpdate,params)
}
/**
 * 检查单二级数据 -> 分析列表
 */
export const checklistAnalysePageApi = async (id:number|string)=>{
  // get
  return http.get(Api.checklistParams,{stageId:id})
}
/**
 * 分析项列表增加
 */
export const checklistAnalyseAddApi = async (data)=>{
  return http.post(Api.checklistAdd,data)
}
/**
 * 分析列表删除 和 检查单删除 type 0 分析 1 检查单 
 */
export const checklistRemoveApi=(params)=>{
  return http.deleteApi(Api.checklistDelete,params)
}
/**
 * 检查单查询
 */
export const checklistChecklistPageApi=(params:Object)=>{
  return http.get(Api.checkListPage,params)
}
/**
 * 新增检查单
 */
export const checklistChecklistAddApi=(data)=>{
  return http.post(Api.checkListAdds,data)
}